From: kaf24@firebug.cl.cam.ac.uk Date: Wed, 10 May 2006 15:07:46 +0000 (+0100) Subject: The PciController class lacks a configuration method to re-generate the X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~16047^2~94 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=cf6a9db5e60c3329bb61c13c7d7879f0323fa5cc;p=xen.git The PciController class lacks a configuration method to re-generate the configuration of an existing domain. This is needed for a domain to be able to reboot and retain its PCI device configuration. This patch adds such support. Thanks to Mike Wright for reporting this problem and working with me to fix it. Signed-off-by: Ryan Wilson --- diff --git a/tools/python/xen/xend/server/pciif.py b/tools/python/xen/xend/server/pciif.py index 16844cc6ff..55e5732ac5 100644 --- a/tools/python/xen/xend/server/pciif.py +++ b/tools/python/xen/xend/server/pciif.py @@ -31,6 +31,7 @@ import xen.lowlevel.xc from xen.util.pci import PciDevice import resource +import re xc = xen.lowlevel.xc.xc() @@ -106,6 +107,30 @@ class PciController(DevController): return (0, back, {}) + def configuration(self, devid): + """@see DevController.configuration""" + + result = DevController.configuration(self, devid) + + (num_devs) = self.readBackend(devid, 'num_devs') + + for i in range(int(num_devs)): + (dev_config) = self.readBackend(devid, 'dev-%d'%(i)) + + pci_match = re.match(r"((?P[0-9a-fA-F]{1,4})[:,])?" + \ + r"(?P[0-9a-fA-F]{1,2})[:,]" + \ + r"(?P[0-9a-fA-F]{1,2})[.,]" + \ + r"(?P[0-9a-fA-F]{1,2})", dev_config) + if pci_match!=None: + pci_dev_info = pci_match.groupdict('0') + result.append( ['dev', \ + ['domain', '0x'+pci_dev_info['domain']], \ + ['bus', '0x'+pci_dev_info['bus']], \ + ['slot', '0x'+pci_dev_info['slot']], \ + ['func', '0x'+pci_dev_info['func']]]) + + return result + def setupDevice(self, domain, bus, slot, func): """ Attach I/O resources for device to frontend domain """